package utils;

import jason.environment.grid.Location;

public class Utils {
	public static Location getClosestCell(int agx, int agy, int obstx, int obsty){
		Location l = new Location(obstx,obsty);
		if(Math.abs(obstx - agx) > 1){
			if(obstx > agx){
				l.x--;
			} else {
				l.x++;
			}
		}
		if(Math.abs(obsty - agy) > 1){
			if(obsty > agy){
				l.y--;
			} else {
				l.y++;
			}
		}
		return l;
	}
}
